(require* sketch/parse/rule/common/line)
(require* sketch/parse/rule/common/block)
(require* sketch/parse/rule/common/blockx)
(require* sketch/parse/rule/common/arrowx)
(require* sketch/parse/rule/common/link)

(import sketch.shape.domain.flowchart.*)

(defrule fc-block
	""
    ?f <- (shape (name "Rectangle") (obj ?r))
    =>
    (printout "recognize fc-block = rectangle")
    (bind ?sh (new FCBlock))
    (?sh setRefPoint (?r getRefPoint))
    (?sh setWidth (?r getWidth))
    (?sh setHeight (?r getHeight))
    (retract ?f)
    (assert (shape
            (name "FCBlock")
            (obj ?sh)
            (children ?r)))
    (recognize ?sh (list-children (create$ ?r))))

(defrule fc-choice
	""
    ?f <- (shape (name "Diamond") (obj ?r))
    =>
    (printout "recognize fc-choice = diamond")
    (bind ?sh (new FCChoice))
    (?sh setRefPoint (?r getRefPoint))
    (?sh setWidth (?r getWidth))
    (?sh setHeight (?r getHeight))
    (retract ?f)
    (assert (shape
            (name "FCChoice")
            (obj ?sh)
            (children ?r)))
    (recognize ?sh (list-children (create$ ?r))))




